
public class ArrayDemo {

	public static void main(String[] args) {
		// declared and created array
		
		int[] ages = new int [10];
		
		// assign some values.
		
		ages[0] = 23;
		ages[1] = 35;
		ages[2] = 55;
		ages[3] = 67;
		
		//Reading the values from an array.
		System.out.println("size of an array =" + ages.length);
		System.out.println("first age =" + ages[0]);
		System.out.println("second age =" + ages[1]);

		System.out.println("third age =" + ages[2]);
		
		System.out.println("last age =" + ages[9]);
		
		//reading all the values of an array.
		
		for(int i=0; i<ages.length; i++){
			System.out.println("value at index =" + i + "is" + ages[i]);
			
			
		}
		
		
		
		
		
		
		
		
		
		
		
		
	}

}
